<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .area{
            width: 200px;
            height: 200px;
            background: #000;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <script src="../vuejs/vue.js"></script>
    <template id="my-app">
        <!-- 完整写法，v-on:监听事件=“methods中的方法” -->
       <button v-on:click="btnClick">点击</button>
       <div class="area" v-on:mousemove="mouseMove"></div>
       <!-- 语法糖简写 -->
       <button @click="btnClick">点击</button>
       <!-- 绑定一个表达式 -->
       <button @click="counter++">{{counter}}</button>
       <!-- 绑定一个对象 -->
       <div class="area" v-on="{click:btnClick,mousemove:mouseMove}"></div>
    </template>
    <script>
        Vue.createApp({
            template:`#my-app`,
            data(){
                return{
                    counter:0
                }
            },
            methods:{
                btnClick(){
                    console.log('点击了');
                },
                mouseMove(){
                    console.log('鼠标移动了');
                }
            }

        }).mount('#app')
    </script>
</body>
</html>